using SqlSugar;

namespace ChatBackend.Models
{
    [SugarTable("Users")]
    public class User
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        [SugarColumn(Length = 50, IsNullable = false)]
        public string Username { get; set; } = string.Empty;

        [SugarColumn(Length = 100, IsNullable = false)]
        public string Email { get; set; } = string.Empty;

        [SugarColumn(Length = 255, IsNullable = false)]
        public string PasswordHash { get; set; } = string.Empty;

        [SugarColumn(Length = 100, IsNullable = true)]
        public string? DisplayName { get; set; }

        [SugarColumn(Length = 500, IsNullable = true)]
        public string? Avatar { get; set; }

        [SugarColumn(IsNullable = false, ColumnDataType = "TEXT")]
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

        [SugarColumn(IsNullable = false, ColumnDataType = "TEXT")]
        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

        [SugarColumn(IsNullable = false)]
        public bool IsOnline { get; set; } = false;

        [SugarColumn(IsNullable = true, ColumnDataType = "TEXT")]
        public DateTime? LastSeenAt { get; set; }
    }
}
